/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Print;

import gui.usergui.ResultFrame;
import java.awt.print.Book;
import java.awt.print.PageFormat;
import java.awt.print.Pageable;
import java.awt.print.Printable;
import java.awt.print.PrinterJob;

/**
 *
 * @author RATSUF
 */
public class ExperimentPrinter {
    private ResultFrame rf;
    
    public ExperimentPrinter(ResultFrame rf){
        this.rf = rf;
        
    }
    //boolean check;
//    public ExperimentPrinter(boolean check) {
//        this.check = check;
//    }

    public void Printer() {
        
        PrinterJob pj = PrinterJob.getPrinterJob();
        PageFormat pf = new PageFormat();
        ExperimentReportCreator erc = new ExperimentReportCreator(rf);
        pj.pageDialog(pf);
        pf = pj.defaultPage(pf);
        
        pj.printDialog();
        pj.setPrintable(erc);
	try{
		pj.print();
		Thread.sleep(1000);
	}catch(Exception e){
		System.err.println(e.getMessage());
	}
//        Book tb = new Book();
//        tb.append(new ExperimentReportCreator(rf), pf);
//        pj.setPageable(tb);
//        try {
//            pj.print();
//            Thread.sleep(1000);
//        } catch (Exception e) {
//            System.err.print(e.getMessage());
//        }
    }
}
